const arr = [66, 88, 12, 87, 100, 5, 566, 23]

const shellSort = (arr) => {
  let gap = Math.floor(arr.length / 2)

  while (gap >= 1) {
    for (let i = gap; i < arr.length; i++) {
      let temp = arr[i]
      let j = i

      while (arr[j - gap] > temp && j > 0) {
        arr[j] = arr[j - gap]
        j -= gap
      }
      arr[j] = temp
    }
    gap = Math.floor(gap / 2)
  }
}

shellSort(arr)

console.log('arr', arr);
